'use strict';
angular.module('app').config([
    '$stateProvider','$urlRouterProvider','$httpProvider','$provide',
     function ($stateProvider,$urlRouterProvider,$httpProvider,$provider) {
             FastClick.attach(document.body);

         $stateProvider.state(
             'integral_main',{
                 url:'/integral_main',
                 templateUrl:'views/integral/integral_main.html',
                 controller:'integralCtrl'
             }
         ).state(
             'daily_task',{
                 url:'/daily_task',
                 templateUrl:'views/integral/daily_task.html',
                 controller:'dailyTackCtrl'
             }
         ).state(
             'integral_product_details',{
                 url:'/integral/product_details/:li/:id',
                 templateUrl:'views/integral/product_details.html',
                 controller:'productIntegralCtrl'
             }
         ).state(
             'integral_sign',{
                 url:'/integral/sign',
                 templateUrl:'views/integral/sign.html',
                 controller:'signCtrl'
             }
         ).state(
             'address',{ //地址列表
                 url:'/integral/address',
                 templateUrl:'views/integral/address.html',
                 controller:'addressCtrl'
             }
         ).state(
             'address_select',{
                 url:'/integral/address_select',
                 templateUrl:'views/integral/address_select.html',
                 controller:'addressCtrl'
             }
         ).state(
             'address_add',{
                 params:{
                     editedAddress:null
                 },
                 url:'/integral/add_address',
                 templateUrl:'views/integral/address_add.html',
                 controller:'addressAddCtrl'
             }
         ).state(
             'integral_order',{
                 url:'/integral/order',
                 templateUrl:'views/integral/order.html',
                 controller:'integralOrderCtrl'
             }
         ).state(
             'integral_details',{
                 url:'/integral/details',
                 templateUrl:'views/integral/integral_details.html',
                 controller:'integralDetailsCtrl'
             }
         );

         var isapp = false
         try {
             if(wv) {
                 isapp = true
             }
         } catch(e) {

         }
         if(isIPhoneX()){
             var meta = document.getElementsByTagName('meta');
             meta["viewport"].setAttribute('content',"width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no,viewport-fit=cover");
             $('body').css('margin-top','88px');
         }else {

         }
         function isIPhoneX(){
           if(isapp){
               var u = navigator.userAgent;
               var isIOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端
               if (isIOS) {
                   if (screen.height == 812 && screen.width == 375){
                       //是iphoneX
                       return true
                   }else{
                       //不是iphoneX
                       return false
                   }
               }
           }else {
               return false
           }
         }
     }]




);

